package prolog.terms
import prolog.builtins._

abstract class Fluent extends SystemObject {
  private var persistent = false
  def this(p: Prog) = {
    this()
    trailMe(p)
  }

  def setPersistent(persistent: Boolean) {
    this.persistent = persistent
  }

  def getPersistent = this.persistent

  protected def trailMe(p: Prog) {
    if (null != p)
      p.getTrail.push(this.asInstanceOf[Var])
  }

  protected def undo = {
    if (!persistent)
      stop()
  }
}